/*
 * DateTool.java
 *
 * Created on September 15, 2006, 11:53 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.org.kasir.model;

/**
 *
 * @author City_Z
 */
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTool {
	/**
     * Mengembalikan bentuk string dari sebuah tanggal
     * @param string - String
     * @param patern - String
     * @return String tanggal 
     */
    public String dateToString(Date tgl,String format){
        String hasil="";        
        if(format==null || "".equals(format) || "null".equalsIgnoreCase(format)){           
            return null;
        }else{           
           try{                     
               SimpleDateFormat dateParser = new SimpleDateFormat(format);
               hasil  = dateParser.format(tgl);               
           }catch(Exception e){
               System.out.println(e.getMessage());
           }
           return hasil;
        }
   }       

}

